<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>{$shop_name|default='飞行猫'}管理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="__STATIC_LIB__layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="__STATIC_LIB__layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" href="__STATIC_LIB__layuiadmin/style/login.css" media="all">


</head>

<style>
    .s1{ display: block;}
    .fl{float: left}
    #yzm{    width: 170px;
        margin-right: 10px;
        background: url(/static/pc/img/login_code.png) no-repeat 15px center;
        height: 40px;
        line-height: 40px;
        padding: 0;
        padding-left: 60px;
        border-radius: 5px;
        font-family: inherit;
        font-size: inherit;
        font-style: inherit;
        font-weight: inherit;
        outline: 0;
        border: 1px solid #d3d3d3;
        box-sizing: border-box;
    }
    #captcha_img{
        width: 120px;
        height: 30px;
        margin-top: 8px;
        vertical-align: middle;}
</style>

<body>

    <div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">

        <div class="layadmin-user-login-main">
            <div class="layadmin-user-login-box layadmin-user-login-header">
                <h2>飞行猫</h2>
                <p>杭州飞行猫 -- 致力于为客户创造有价值的产品</p>
            </div>
            <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
                <form class="layui-form">

                    <div class="layui-form-item">
                        <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"></label>
                        <input type="text" name="username" id="LAY-user-login-username" lay-verify="required" placeholder="账号" class="layui-input">
                    </div>
                    <div class="layui-form-item">
                        <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
                        <input type="password" name="password" id="LAY-user-login-password" lay-verify="required" placeholder="密码" class="layui-input">
                    </div>

                    <div class="layui-form-item">
                        <span class="fl s1">
                            <input type="text" id="yzm" name="yzm" class="login_code" required="" lay-verify="required" placeholder="验证码">
                        </span>
                        <span class="fl s2">
                            <a href="#" onclick='setCaptcha()'>
                                <img  src="{:captcha_src()}" id="captcha_img" style="width: 120px;height: 30px;">
                            </a>
                        </span>
                    </div>

                    <div class="layui-form-item">
                        <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="password_login">登 录</button>
                    </div>
                </form>
            </div>
        </div>

        <div class="layui-trans layadmin-user-login-footer">
            <p>© {:date('Y')} <a href="https://www.jihainet.com/">广东房帮手</a></p>
        </div>
    </div>
	<canvas id="canvas"></canvas>
	<script src="__STATIC__js/login-bg.js"></script>
    <script src="__STATIC_LIB__layuiadmin/layui/layui.js"></script>
    <script src="__STATIC_JS__jquery.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="__STATIC_JS__kimoji.js"></script>
    <script>

        function setCaptcha() {
            $('#yzm').val("");
            var timestamp=new Date().getTime();
            $('#captcha_img').attr('src','{:captcha_src()}?'+timestamp);
        }


        layui.config({
            base: '__STATIC_LIB__layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form'], function() {
            var $ = layui.$,
                setter = layui.setter,
                admin = layui.admin;

            var form = layui.form;
            form.render();

            //提交
            form.on('submit(password_login)', function(data) {
                JsPost("{:url('admin/user/login')}", data.field, function(data){
                    if (data.status) {
                        console.log(data,'返回的参数')
                        //保存token
                        layui.data(setter.tableName, {
                            key: setter.request.tokenName
                            ,value: data.token
                        });
                        layer.msg('登陆成功，跳转中!!!...');
                        setTimeout("window.location.href='/admin.html'; ", 1500);
                    } else {
                        if (data.data == '10013' || data.data == '10012') {
                            $('#captcha_div').show();
                        }
                        // setCaptcha();
                        layer.msg(data.msg);
                    }
                });
                return false;
            });
        });
    </script>
</body>
<style>
body {
  background-color: #eee;
  overflow: hidden;
}
canvas {
  background-color: #eee;
  display: block;
  margin: 0 auto;
  position: absolute;
  top: 0;
}
.layadmin-user-login{
	z-index: 99;
}
</style>
</html>